package models;

import models.crudsiena.SienaSupport;
import siena.Generator;
import siena.Id;
import siena.NotNull;
import utils.TextConverter;

import java.util.List;

/**
 * Created by Gipxy group
 * Date: 5/13/12
 */
public class AppGroup extends SienaSupport {
    @Id(Generator.AUTO_INCREMENT)
    public Long id;

    @NotNull
    public String language;

    @NotNull
    public String code;
    public String title;

    public String brief;


    public byte[] photo;

    public Integer order;
    
    public List<App> getAllApp(){
        List<App> fetch = App.all(App.class).filter("groupCode", code).filter("language", language).order("order").fetch();
        return fetch;
    }

    public String getShortTitle(){
        return TextConverter.convertToShortUrl(title);
    }

}
